<template>
  <div
    style="display: flex; justify-content: center; border-bottom: 1px solid #181818"
    @click="doCollapse"
  >
    <el-icon :size="20">
      <Fold v-show="!isCollapse" />
      <Expand v-show="isCollapse" />
    </el-icon>
  </div>
  <el-menu
    active-text-color="#ffd04b"
    background-color="#e2ecff"
    class="el-menu-vertical-demo"
    text-color="#1a2b3e"
    @open="handleOpen"
    @close="handleClose"
    :collapse="isCollapse"
    router
  >
    <el-sub-menu index="1">
      <template #title>
        <el-icon><Setting /></el-icon>
        <span style="font-weight: 900; color: #181818; font-size: rem">系统管理</span>
      </template>
      <el-menu-item-group title="Group One">
        <el-menu-item index="1-1">item one</el-menu-item>
        <el-menu-item index="1-2">item two</el-menu-item>
      </el-menu-item-group>
      <el-menu-item-group title="Group Two">
        <el-menu-item index="1-3">item three</el-menu-item>
      </el-menu-item-group>
      <el-sub-menu index="1-4">
        <template #title>item four</template>
        <el-menu-item index="1-4-1">item one</el-menu-item>
      </el-sub-menu>
    </el-sub-menu>

    <!-- 运营管理 -->
    <el-sub-menu index="yunying">
      <template #title>
        <el-icon><TrendCharts /></el-icon>
        <span>运营管理</span>
      </template>
      <el-menu-item index="station">站点管理</el-menu-item>
      <el-menu-item index="schedule">列车时刻表</el-menu-item>
      <el-menu-item index="">车辆管理</el-menu-item>
    </el-sub-menu>
    <el-sub-menu index="tabs">
      <template #title>
        <el-icon><setting /></el-icon>
        <span>tabs</span>
      </template>
      <el-menu-item index="a">AAA</el-menu-item>
      <el-menu-item index="b">BBB</el-menu-item>
    </el-sub-menu>
  </el-menu>
</template>

<script setup>
import { ref } from 'vue'
import { Fold, TrendCharts, Setting, Expand } from '@element-plus/icons-vue'

import { useAsideStore } from '../../stores/aside'

const asideStore = useAsideStore()
let isCollapse = ref(false)

const doCollapse = () => {
  asideStore.asidee = !asideStore.asidee
  isCollapse.value = !isCollapse.value
}

const handleOpen = (key, keyPath) => {
  console.log(key, keyPath)
}
const handleClose = (key, keyPath) => {
  console.log(key, keyPath)
}
</script>

<style scoped>
.el-icon {
  margin: 0.375rem;
  color: #7c72f2;
  font-size: 1.5rem;
  font-weight: 800;
}
</style>
